import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DeviceStrategyVO, DeviceStrategyForm, DeviceStrategyQuery } from '@/api/device/deviceStrategy/types';

/**
 * 查询设备通行策略列表
 * @param query
 * @returns {*}
 */

export const listDeviceStrategy = (query?: DeviceStrategyQuery): AxiosPromise<DeviceStrategyVO[]> => {
  return request({
    url: '/device/deviceStrategy/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询设备通行策略详细
 * @param id
 */
export const getDeviceStrategy = (id: string | number): AxiosPromise<DeviceStrategyVO> => {
  return request({
    url: '/device/deviceStrategy/' + id,
    method: 'get'
  });
};

/**
 * 新增设备通行策略
 * @param data
 */
export const addDeviceStrategy = (data: DeviceStrategyForm) => {
  return request({
    url: '/device/deviceStrategy',
    method: 'post',
    data: data
  });
};

/**
 * 修改设备通行策略
 * @param data
 */
export const updateDeviceStrategy = (data: DeviceStrategyForm) => {
  return request({
    url: '/device/deviceStrategy',
    method: 'put',
    data: data
  });
};

/**
 * 删除设备通行策略
 * @param id
 */
export const delDeviceStrategy = (id: string | number | Array<string | number>) => {
  return request({
    url: '/device/deviceStrategy/' + id,
    method: 'delete'
  });
};
